import { createRouter, createWebHistory } from "vue-router";

const Layout = () => import("../layout/index.vue");

export const routes = [
  {
    path: "/dashboard",
    component: Layout,
    // meta: {
    //   title: "工作台",
    //   icon: "xxx",
    // },
    children: [
      {
        path: "",
        component: () => import("../views/dashboard/index.vue"),
        name: "dashboard",
        meta: {
          title: "工作台",
          icon: "Odometer",
        },
      },
    ],
  },
  {
    path: "/product",
    component: Layout,
    meta: {
      title: "商品管理",
      icon: "Basketball",
    },
    children: [
      {
        path: "trademark",
        component: () => import("../views/product/trademark/index.vue"),
        name: "trademark",
        meta: {
          title: "品牌管理",
        },
      },
      {
        path: "attr",
        component: () => import("../views/product/attr/index.vue"),
        name: "attr",
        meta: {
          title: "属性管理",
        },
      },
    ],
  },
  {
    path: "/acl",
    component: Layout,
    meta: {
      title: "权限管理",
      icon: "Key",
    },
    children: [
      {
        path: "user",
        component: () => import("../views/acl/user/index.vue"),
        name: "user",
        meta: {
          title: "用户管理",
        },
      },
      {
        path: "role",
        component: () => import("../views/acl/role/index.vue"),
        name: "role",
        meta: {
          title: "角色管理",
        },
      },
    ],
  },
  {
    path: "/:pathMatch(.*)*",
    name: "any",
    redirect: "/dashboard",
    meta: { hidden: true },
  },
];

export default createRouter({
  history: createWebHistory(),
  routes,
});
